<?php
	$obj=new User();
	if ( strcasecmp( @ $_SERVER['REQUEST_METHOD'], 'POST' ) == 0 )
	{
		//print_r($_POST['delete']);
		$arr=$_POST['delete'];
		$s=arrToList($arr,",");

		foreach($arr as $key => $val)
		{
			$obj->UserID=$val;
			$obj->delete($conn);
		}
		linkto("?module=$module");	
	}
?>
<form name="f" action="" method="post" enctype="multipart/form-data">
<div class="ContentTitle">
    <div class="left" style="padding-top:8px"><?php echo $objModule->ModuleName?></div>
    <div class="CMSButton right">
        <?php
		if($objUserType->isAllow($objModule->ModuleID,1)!=-1)
		{
		?>
		<a href="?module=<?php echo $module?>&action=add">Thêm</a>
		<?php
		}
		?>
        <?php
        if($objUserType->isAllow($objModule->ModuleID,2)!=-1)
		{
		?>
                <a href="#" onclick="fsubmit()">Xóa</a>
		<?php
		}
		?>
    </div>    
    <div class="clear"></div>
</div>
<ul id="ContentTabs" class="shadetabs">
    <!--
    <li><a class="selected" onclick="ShowHideDiv('Tab',1,2)">General Information</a></li>
    <li><a onclick="ShowHideDiv('Tab',1,2)">Account Information</a></li>
    -->
</ul>       

<div id="Tab1" class="TabContainer" style="display:block">
<!-------------CONTENT OF EACH MODULE ---------------------------->
<table width="100%" class="list">
	<thead>
   	  <tr class="thead">
      	  <td class="tdright" width="33">
          <input type="checkbox" onclick="$('input[name*=\'delete\']').attr('checked', this.checked);"/>
          </td>
          <td class="tdleft">UserID</td>
          <td class="tdleft">User Name</td>
          <td class="tdleft">User Type</td>
          <td class="tdcenter"></td>
      </tr>
    </thead>
    <tbody>
<?php
	
	$data=array();
	$data=$obj->travel(" WHERE UserTypeID <> 'supperadmin'");
	for($i=0;$i<count($data);$i++)
	{
		$obj->loadByKey($data[$i]);
		$ustype=new UserType();
		$ustype->loadByKey($obj->UserTypeID);
		$class="even";
		if($i%2!=0)
			$class="odd";
?>
    	<tr class="<?php echo $class?>">
            <td class="tdright">
             <input type="checkbox" name="delete[delete[<?php echo $i?>]]" value="<?php echo $obj->UserID?>"/>
            </td>
            <td class="tdleft"><?php echo $obj->UserID?></td>
            <td class="tdleft"><?php echo $obj->UserName?></td>
            <td class="tdleft"><?php echo $ustype->UserTypeName?></td>
          	<td class="tdcenter">
<?php
		if($objUserType->isAllow($objModule->ModuleID,3)!=-1)
		{
?>
            	[<a class="buttonlink" href="?module=<?php echo $module?>&action=get&id=<?php echo $obj->UserID?>">Chỉnh sửa</a>]
<?php
		}
?>

            </td>
        </tr>
<?php
	}
?>
    </tbody>
</table>
<!-------------END CONTENT OF EACH MODULE ---------------------------->
</div>
</form>
<script language="javascript">
from=document.f
function fsubmit()
{
	anser=confirm('Are you sure delete !')
	if(anser==true)
	{
		from.submit()
	}
}
</script>